﻿#region References
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Xen;
#endregion

namespace Ness.Engine.Entities
{
    /// <summary>
    /// The base class for any networked entity, majority overrides
    /// </summary>
    class Entity : Actor, IUpdate
    {
        public int id;

        /// <summary>
        /// Initialises the base entity down to the Actor core (CLIENT)
        /// </summary>
        /// <param name="game">The current engine instance</param>
        /// <param name="model">The model path relative to Content</param>
        public Entity(Engine game, string model, int id, bool applyLights)
            : base(game, model, applyLights)
        {
            this.game = game;
            this.id = id;
        }

        /// <summary>
        /// Initialises the base entity down to the Actor core
        /// </summary>
        /// <param name="game">The current engine instance</param>
        /// <param name="model">The model path relative to Content</param>
        public Entity(Engine game, string model, bool applyLights)
            : base(game, model, applyLights)
        {
            this.game = game;
            id = game.entityCount+1;

            game.UpdateManager.Add(this);
        }

        /// <summary>
        /// Overrides the default ToString method to return entity ID
        /// </summary>
        /// <returns>Returns the entity ID (ent_int)</returns>
        public override string ToString()
        {
            return "ent_" + id;
        }

        /// <summary>
        /// Updates the entity
        /// </summary>
        /// <param name="state">Passed automatically. Ignore.</param>
        /// <returns>UpdateFrequency.FullUpdate60hz</returns>
        UpdateFrequency IUpdate.Update(UpdateState state)
        {
            return UpdateFrequency.FullUpdate60hz;
        }
    }
}
